home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 7: Sunsite / Linux Cubed Series 7 - Sunsite Vol 1.iso / system / shells / scsh-0.4 / scsh-0 / scsh-0.4.2 / rts / eval.scm < prev    next >
Text File  |  1995-10-13  |  2KB  |  68 lines

  1. ; Copyright (c) 1993, 1994 Richard Kelsey and Jonathan Rees.  See file COPYING.
  2.  
  3. ; Added really-eval-scanned-forms, which gives you noise control.
  4. ;     -Olin 6/95.
  5.  
  6. ; This file contains things that tie together the compiler and the
  7. ; run-time system.
  8.  
  9.  
  10. ; EVAL
  11.  
  12. (define (eval form p)
  13.   (compile-and-run-forms (list form) p #f
  14.              (lambda (template)
  15.                (invoke-template template p))
  16.              #f))
  17.  
  18. ; LOAD-INTO - load file into package.
  19.  
  20. (define (load-into filename p)
  21.   (compile-and-run-file filename p
  22.             (lambda (template)
  23.               (invoke-template template p))
  24.             (current-output-port)))
  25.  
  26. ; For scsh.
  27.  
  28. (define (load-quietly filename p)
  29.   (compile-and-run-file filename p
  30.             (lambda (template)
  31.               (invoke-template template p))
  32.             #f))
  33.  
  34. ; Evaluate forms as if they came from the given file.
  35.  
  36. (define (eval-from-file forms p filename)
  37.   (compile-and-run-forms forms p filename
  38.              (lambda (template)
  39.                (invoke-template template p))
  40.              (current-output-port)))
  41.  
  42. ; For ENSURE-LOADED.
  43.  
  44. (define (eval-scanned-forms forms p filename)
  45.   (really-eval-scanned-forms forms p filename (current-output-port)))
  46.  
  47. (define (really-eval-scanned-forms forms p filename noise-port)
  48.   (compile-and-run-scanned-forms forms p filename
  49.                  (lambda (template)
  50.                    (invoke-template template p))
  51.                  noise-port))
  52.  
  53. (define (invoke-template template p)
  54.   (invoke-closure (make-closure template (package-uid p))))
  55.  
  56.  
  57. ; LOAD
  58.  
  59. (define (load filename . package-option)
  60.   (let ((p (if (null? package-option)
  61.            (interaction-environment)
  62.            (car package-option))))
  63.     ;; (with-interaction-environment p
  64.       ;; (lambda ()
  65.     (noting-undefined-variables p
  66.       (lambda ()
  67.         (load-into filename p)))));; ))
  68.